#include <stdio.h>
#include <stdlib.h>


struct node 
{
	struct node *next;
	unsigned char value;
};

struct node *head = NULL;


struct predata
{
	unsigned int type;
	unsigned int done;
	unsigned char buf[10];

	void (*httpdump)(struct predata *, unsigned int *);

};



struct httpfit
{
	unsigned int type;
	unsigned int done;
	unsigned char buf[10];

	void (*httpfit)(struct httpfit *, unsigned int *);

};


typedef int (*callback)(unsigned char *buf, unsigned int len);

static int (*func)(unsigned char *buf, unsigned int len);

int buddle_sort(unsigned char *buf, unsigned int len)
{
	printf("buddle_sort \n");
}


int yytek_open(void **dev)
{
	printf(" dev  = %p \n", dev);

	struct node *lp = calloc(1, sizeof(struct node));
	lp->value = 10;

	*dev = lp;	

	if(!*dev){
		printf("error \n");
		return -1;
	}

	printf(" lp  = %p \n", lp);

	return 0;
}


int main(int argc, char *argv[])
{

	unsigned char buf[10];
	callback fun = buddle_sort;

	func = buddle_sort;

	printf("hello world  \n");

	func(buf,10);
	fun(buf,10);

	void *dev = NULL;

	printf(" &dev = %p \n", &dev);

	yytek_open(&dev);

	printf(" dev = %p \n", dev);

	struct node * led = (struct node *)dev;
	printf("led->value = %d \n", led->value);


	head =(struct node *)malloc(1 * sizeof(struct node));
	head->next = NULL;

	struct node *zm = NULL;
	zm = (struct node *)malloc(1 * sizeof(struct node));
	zm->value = 12;
	zm->next = NULL;
	head->next = zm;

	struct node *fp = NULL;
	fp = head;

	while(fp->next != NULL)
	{
		fp = fp->next;
		printf("fp->value = %d \n", fp->value);
	}
	

}
